package com.df.my_net_game.net.websocket;

import com.df.my_net_game.net.base.GTcpServer;
import lombok.Data;

@Data
public class GWebsocketServer extends GTcpServer {
    public String path;


    @Override
    protected void prepare() {
        if(path==null){
            path= "/";
        }
        if(channelInitializer==null){
            channelInitializer = new GwebSocketDefatultChannelInitializer(this);
        }
        super.prepare();

        if(handlers.isEmpty()){
            handlers.add(()->{
                return new GWebsocketDefaultMsgHandler(serverCB,this);
            });
        }
    }

    public GTcpServer setPath(String path) {
        this.path = path;
        return this;
    }
}
